package com.dragon.logical.service.finance;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.dragon.repository.entity.CustomerPayment;
import com.dragon.repository.entity.PlanCollect;
import com.dragon.repository.entity.PlanCustomerPayment;
import org.springframework.transaction.annotation.Transactional;

import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * 计划回款表 服务类
 * </p>
 *
 * @author sy
 * @since 2023-06-30
 */
public interface IPlanCollectService extends IService<PlanCollect> {

    Page<PlanCollect> planList(Integer page, Integer limit, String search, Integer customerId, Integer planStatus, String startTime, String endTime);

    Integer addPlan(PlanCollect plan);

    void updatePlan(PlanCollect plan);

    void deletePlan(Integer id);

    List<PlanCollect> selectByContractId(Integer contractId);

    PlanCollect selectByPlId(Integer id);

    @Transactional
    void updateStatus(CustomerPayment customerPayment);

    void generateList(CustomerPayment customerPayment, Boolean updateStatus);

    Map<String, Object> financeStatistics();

    void updateData();

    /**
     * 获取 应收 年金额
     * @param year
     * @return
     */
    Map<String,Object> moneyForYear(String year);

    /**
     * 列表数据
     * @return
     */
    Map<String,Object> listStatistics();

    /**
     * 当前年各个月应收金额
     * @param time
     * @return
     */
    LinkedHashMap<String,Object> planMonthlyStatistics(String time);

    /**
     * 总额占比（应收实收）
     * @param time
     * @return
     */
    Map<String, Object> totalPercentage(String time);

    /**
     * 应收实收月统计
     * @param time
     * @return
     */
    List<PlanCustomerPayment> planCustomerPaymentStatist(String time);

    /**
     * 财务年统计
     * @param time
     * @return
     */
    Map<String, Object> financeTotal(String time);
}
